//
//  AbstractLogger.m
//  责任链模式
//
//  Created by flannery on 2018/12/18.
//  Copyright © 2018年 flannery. All rights reserved.
//

#import "AbstractLogger.h"

@interface AbstractLogger ()
@end
@implementation AbstractLogger
- (void)setNextLoggering:(AbstractLogger *)nextLogger{
    static int count;
    NSLog(@"setNextLogger %d", count++);
    NSLog(@"%@", [NSString stringWithUTF8String:object_getClassName(self)]);
    self.nextLogger = nextLogger;
}

- (void)logMessage:(int)level message:(NSString *)message{
    if(self.level <= level) {
        [self write:message];
    }
    if(self.nextLogger) {
        [self.nextLogger logMessage:level message:message];
    }
}

- (void)write:(NSString *)message{
    
}
@end
